//
//  ViewForTravelTabViewSectionHeader.m
//  ProjectA
//
//  Created by dllo on 16/3/12.
//  Copyright © 2016年 刘旺辉. All rights reserved.
//

#import "ViewForTravelTabViewSectionHeader.h"
#import "AppMacro.h"
#import "ModelForTravelTabViewSectionHeader.h"
@interface ViewForTravelTabViewSectionHeader ()
@property (nonatomic, strong) UIView *viewForLine;
@property (nonatomic, strong) UIView *viewForDa;
@property (nonatomic, strong) UIView *viewForXiao;
@property (nonatomic, strong) UILabel *labelForDay;
@end

@implementation ViewForTravelTabViewSectionHeader
- (void)dealloc {
    [_viewForLine release];
    [_viewForDa release];
    [_viewForXiao release];
    [super dealloc];
}
- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithReuseIdentifier:reuseIdentifier];
    if (self) {
        self.viewForLine = [[UIView alloc] init];
        [self.contentView addSubview:self.viewForLine];
        [_viewForLine release];
        
        self.viewForDa = [[UIView alloc] init];
        [self.contentView addSubview:self.viewForDa];
        [_viewForDa release];
        
        self.viewForXiao = [[UIView alloc] init];
        [self.contentView addSubview:self.viewForXiao];
        [_viewForXiao release];
        
        self.labelForDay = [[UILabel alloc] init];
        [self.contentView addSubview:self.labelForDay];
        [_labelForDay release];
        self.labelForDay.font = [UIFont systemFontOfSize:13];
    }
    return self;
}
- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.viewForLine.frame = CGRectMake(self.bounds.size.width / 18.f, 0, self.bounds.size.width / 70.f, self.bounds.size.height);
    
    
    self.viewForDa.frame = CGRectMake(0, 0, self.bounds.size.width / 20.f, self.bounds.size.width / 20.f);
    self.viewForDa.layer.cornerRadius = self.viewForDa.frame.size.width / 2.f;
    self.viewForDa.layer.masksToBounds = YES;
    self.viewForDa.center = self.viewForLine.center;
    
    self.viewForXiao.frame = CGRectMake(0, 0, self.viewForDa.frame.size.width / 2.f, self.viewForDa.frame.size.height / 2);
    self.viewForXiao.center = self.viewForDa.center;
    self.viewForXiao.layer.cornerRadius = self.viewForXiao.frame.size.width / 2.f;
    self.viewForXiao.layer.masksToBounds = YES;
    
    self.labelForDay.frame = CGRectMake(self.viewForDa.frame.origin.x + self.viewForDa.frame.size.width + 5, self.viewForXiao.center.y - self.labelForDay.frame.size.height / 2.f, self.bounds.size.width - 50, self.bounds.size.height - 10);
    
    
    
    [UIView setColorWithView:self.viewForLine nightColor:L_COLOR_WHITE dayColor:RGBA(172, 135, 79, 1)];
    [UIView setColorWithView:self.viewForDa nightColor:L_COLOR_WHITE dayColor:RGBA(172, 135, 79, 1)];
    [UIView setColorWithView:self.viewForXiao nightColor:L_COLOR_BLACK dayColor:L_COLOR_WHITE];
    [UIView setColorWithLabelText:self.labelForDay nightColor:L_COLOR_WHITE dayColor:L_COLOR_BLACK];
}

- (void)passData:(ModelForTravelTabViewSectionHeader *)model {
    NSString *text = [NSString stringWithFormat:@"第%@天 %@", model.day, model.date];
    self.labelForDay.text = text;
    
}
@end
